<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="stylesheet" href="/static/styles2.css">
</head>
<body>
    <!-- 返回按钮 -->
    <a href="{{ url_for('login') }}" class="back-button">&larr;</a>
    <div class="container">
        <div class="title">注册</div>
        <form method="POST" style="width: 100%;">
            <div class="form-group">
                <input type="text" name="username" placeholder="账号" required minlength="3" maxlength="20">
            </div>
            <div class="form-group">
                <input type="password" name="password" placeholder="密码" required minlength="6">
            </div>
            <div class="form-group">
                <input type="password" name="confirm_password" placeholder="请确认密码" required minlength="6">
            </div>
            <div class="btn-group-custom">
                <button type="submit" class="btn-custom">注册</button>
            </div>
        </form>
        <!-- 显示消息 -->
        {% with messages = get_flashed_messages(with_categories=true) %}
          {% if messages %}
            <div class="alert alert-danger flash-message">
              <ul>
                {% for category, message in messages %}
                  <li>{{ message }}</li>
                {% endfor %}
              </ul>
            </div>
          {% endif %}
        {% endwith %}
        <div class="text-center">
            <a href="{{ url_for('login') }}" class="text-link">已有账号? 登录</a>
        </div>
    </div>
</body>
</html>
